﻿using SearchScreen.SearchScreenModule.ViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SearchScreen.SearchScreenModule.View
{
    /// <summary>
    /// Interaction logic for DomainTypesView.xaml
    /// </summary>
    public partial class DomainTypesView : UserControl
    {
        public ObservableCollection<string> listings {get; private set;}
        public ObservableCollection<TreeView> listingTree { get; private set; }

        public DomainTypesView()
        {
            InitializeComponent();

            listings = new ObservableCollection<string>();
            listingTree = new ObservableCollection<TreeView>();

            this.DataContext = new RootDomainTypesViewModel();

            //DomainTypesViewModel root = this.tree.Items[0] as DomainTypesViewModel;

            //base.CommandBindings.Add(
            //    new CommandBinding(
            //        ApplicationCommands.Undo,
            //        (sender, e) => // Execute
            //        {
            //            e.Handled = true;
            //            root.IsChecked = false;
            //            this.tree.Focus();
            //        },
            //        (sender, e) => // CanExecute
            //        {
            //            e.Handled = true;
            //            e.CanExecute = (root.IsChecked != false);
            //        }));

            //base.CommandBindings.Add(
            //    new CommandBinding(
            //        ApplicationCommands.Save,
            //        (sender, e) =>
            //        {
            //            e.Handled = true;
            //            listings.Clear();
            //            this.GetChecked(root);
            //            this.DisplayList();
            //        }));

            this.tree.Focus();
        }

        //private void GetChecked(DomainTypesViewModel root)
        //{
        //    foreach (DomainTypesViewModel child in root.Children)
        //    {
        //        if (child.Children != null)
        //        {
        //            this.GetChecked(child);
        //        }
        //        if (child.IsChecked == true)
        //        {
        //            this.listings.Add(child.HierarchicalName);
        //        }
        //    }
        //}

        //private void DisplayList()
        //{
        //    StringBuilder sb = new StringBuilder();
        //    foreach (var item in listings)
        //    {
        //        sb.Append(item);
        //        sb.AppendLine();
        //    }

        //    MessageBox.Show(sb.ToString());
        //}

    }
}
